<h1>Preinscripción Acádemica</h1>

<h3><?php echo $this->Section->mensaje($processOpen); ?></h3>

<?php
	
	echo $this->Form->create('Section', array('action'=> 'edit'));

	
?>
<table>
	<tr>
		<td width='20%'>
			
			<?php echo $this->Form->input('Codigo', array('label' => 'Código', 'value' => $codigo['CoursesCode']['code'], 'readOnly' => 'readOnly')); ?>
			
		</td>
		<td width ='47%' colspan='2'>
			<?php echo $this->Form->input('Course.name', array('label' => 'Nombre')); ?>
		</td>
		<td width = '33%'>
			<?php echo $this->Form->input('coordinator', array('label' => 'Coordinador'));?>
		</td>
	</tr>
	<tr>
		<td colspan='4'>
			<table>
				<tr>
				<?php 
				$i = 0;
				foreach($profesores as $profesor){ ?>
				<td>
				<?php 
					//Profesores
					echo $this->Form->input('profesor'.$i, array('label' => 'Profesor', 'value' => $profesor, 'readonly' => 'readonly'));
					$i++; ?>
				</td>
				<?php } ?>
				</tr>
				<tr>
					<td colspan='<?php echo $i; ?>'>
						<?php echo $this->Html->link('Modificar Profesores', array('action' => 'viewProfessor', $seccionId));?>
					</td>
			
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan = '4'>
			<table>
				<tr>
				<?php 
				//Horarios
				$i = 0;
				if(sizeof($horarios) > 0){
				foreach($horarios as $horario){
				?>
					<td>
					<?php echo $this->Form->input('horario'.$i, array('label' => 'Horario', 'value' => $horario, 'readonly' => 'readonly'));
						$i++;
					?>
					</td>
				<?php } }?>
				</tr>
				<tr>
					<td>
				<?php echo $this->Html->link('Modificar horarios', array('action' => 'viewSchedule', $seccionId));
				?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td width='25%'><?php echo $this->Form->input('Course.mandatory', array('label' => 'Curso obligatorio'));?></td>
		<td width='25%'><?php echo $this->Form->input('room', array('label' => 'Requiere sala'));?></td>
		<td width='25%'><?php echo $this->Form->input('exam', array('label' => 'Requiere examen')); ?></td>
		<td width='25%'><?php echo $this->Form->input('teacher_evaluation', array('label' => 'Requiere evaluación docente'));?></td>
	</tr>
	<tr>
		<td><?php echo $this->Form->input('section_number', array('label' => 'Sección'));?></td>
		<td><?php echo $this->Form->input('Course.ud', array('label' => 'UD'));?></td>
		<td><?php echo $this->Form->input('vacancy', array('label' => 'Cupos'));?></td>
		<td></td>
	</tr>
	<tr>
		<td colspan= '4'>
			<?php echo $this->Form->input('Course.program_url', array('label' => 'Url del programa'));?>
		</td>
	</tr>
	
<?php 
	//Requisitos
	$i = 0;
	foreach($requisitos as $requisito){ ?>
	<tr>
	<?php if(sizeof($requisito) > 1){ 
		foreach($requisito as $req){?>
		<?php echo $this->Form->input('req'.$i, array('label'=> 'Requisito', 'options' => $requisito)); ?>
					
	<?php }}else{ ?>
		<td>
			<?php echo $this->Form->input('req'.$i, array('label' => 'Requisito', 'value' => $requisito));?>
		</td>
		<td>
			<?php echo $this->Form->input('relacion'.$i, array(
				'label' => 'Tipo', 
				'options' => $relaciones,
				'selected' => 1
				));?>
		</td>
		<td>
			<?php echo $this->Html->link('Eliminar', array('onclick' => 'updateRequisites('.$i.');')); ?>
		</td>
		<?php } ?>
	</tr>
<?php $i++; } ?>
		</td>
	</tr>

	<tr>
		<td colspan='4'>
			<?php echo $this->Form->input('observation', array('label' => 'Observaciones')); ?>
		</td>
	</tr>

	<tr>
		<td width='10%'><?php echo $this->Html->Link('Volver', array('action' => 'index', $processId)); ?></td>
		<td width='10%'><?php echo $this->Html->Link('Eliminar curso en esta Preinscripción', array('controller' => 'Course', 'action' => 'delete', $idCurso)); 
		?></td>

		<td width = '80%' colspan='2'>
			<?php 
				echo $this->Form->hidden('idCurso', array('value' => $idCurso)); 
				echo $this->Form->end('Guardar Cambios'); 
			?>
		</td>

	</tr>
<table>


